<?php
namespace app\store\controller\market;
use app\store\controller\Controller;
use app\common\model\divide\Receive as ReceiveModel;
use think\Session;

/**
 * 用户分红记录
 * Class System
 * @package app\admin\controller\abonus
 */
class Finance extends Controller
{

    /**
     * @return string
     */
    public function index()
    {
        $model = new ReceiveModel();
        $wxapp_id = Session::get('yoshop_store')['wxapp']['wxapp_id'];

        return $this->fetch('index', [
            // 充值记录列表
            'list' => $model->getReceiveList($this->request->param(),$wxapp_id),
            // 属性集
            'statusList' => $model::getStatuslist(),

        ]);
    }

    public function detail($id=null){
        $model = new ReceiveModel();
        $extend=db('divide_receives_user')->where('receives_id',$id)->value('extend');
        $list=json_decode($extend,true);
        return $this->fetch('detail',  [
            // 充值记录列表
            'data' =>$data=$model->getList($id),
            // 属性集
            'list' =>$list
            ]);
    }

}